<template>
	<view class="page">
		<view class="head">
			<view class="left">
				<view class="img-out">
					<image :src="note.faceImage" mode=""></image>
				</view>
			</view>
			<view class="right">
				<view class="up">
					<view class="one">
						<view class="iconfont" :class="note.sex == '1' ? 'icon-male' : 'icon-icon-yxj-female'"
						:style="{color: note.sex == '1' ? '#84A6FE' : '#FC8CA3'}" style="font-size: 20px;"></view>
						<view class="name">
							{{note.nickname}}
						</view>
					</view>
					<view class="two" @tap="toAssist">
						<view class="iconfont icon-ic_heart" :style="{color: ifAssist == '1' ? '#FA607E' : 'gray'}"></view>
						<view class="assist">
							{{assist}}
						</view>
					</view>
				</view>
				<view class="down">
					{{note.content}}
				</view>
			</view>
		</view>
		<view class="tail">
			<view class="out">
				<view class="add-box">
					<view class="address">
						<view class="iconfont icon-ic_dizhi" style="color: #84A6FE;"></view>
						<view class="add-text">
							{{note.pubAddress}}
						</view>
					</view>
					<view class="time">
						{{note.pubTimeStr}}
					</view>
				</view>
				<view class="circle" @tap="viewCircle()">
					{{note.sex == '1' ? '他' : '她'}}的圈子<view class="iconfont icon-ic_r_b" style="font-size: 11px;color: #618CFF;"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: 'noteCompo',
		data() {
			return {
				assist: 0,
				record: {},
				ifAssist: 0
			};
		},
		props:{
			note: {},
			memId: ''
		},
		created() {
			this.assist = this.note.assist;
			this.ifAssist = this.note.ifAssist;
		},
		methods: {
			toAssist(){
				this.record.memId = this.memId;
				this.record.noteId = this.note.id;
				this.$apis.saveAssist(this.record).then((res) => {
					this.assist = res;
					if(this.ifAssist == 0 || this.ifAssist == null){
						this.ifAssist = 1;
					}else {
						this.ifAssist = 0;
					}
				});
			},
			viewCircle(){
				this.$emit('viewCircle', this.note);
			}
		}
	}
</script>

<style>
	@import url("../../static/iconfont/iconfont.css");
	
	.page {
		margin-left: 2.5%;
		background-color: white;
		width: 95%;
		border: 1px solid #EAEAEA;
		border-radius: 12upx;
		margin-top: 35upx;
		align-items: flex-start;
		height: 250rpx;
		box-shadow: 3px 3px 13px 0px rgba(0,0,0,0.1);
		display: flex;
		flex-direction: column;
	}
	.left {
		width: 27%;
	}
	.img-out {
		width: 160upx;
		height: 160upx;
		border-radius: 80upx;
		overflow: hidden;
	}
	.right {
		width: 73%;
	}
	.head {
		display: flex;
		flex-direction: row;
		padding-top: 10px;
		width: 94%;
		margin-left: 3%;
	}
	.circle {
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	image {
		width: 100%;
		height: 100%;
	}
	.up {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
	}
	.one,.two {
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.tail {
		display: flex;
		flex-direction: row;
		width: 94%;
		margin-left: 3%;
		align-items: center;
	}
	.out {
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		width: 100%;
		align-items: center;
		font-size: 14px;
	}
	.add-box {
		display: flex;
		flex-direction: row;
		width: 66%;
		justify-content: space-between;
		align-items: center;
	}
	.address {
		display: flex;
		flex-direction: row;
	}
	.name,.assist {
		margin-left: 8px;
	}
	.time{
		font-size: 12px;
	}
</style>
